package com.hub.netty.server.config;

import io.netty.channel.Channel;

import java.util.concurrent.ConcurrentHashMap;

public class ChannelMap {

    /**
     * 存放客户端标识ID（消息ID）与 channel的对应关系
     */
    public static final ConcurrentHashMap<String, Channel> channelMap = new ConcurrentHashMap<>();

    public static void putChannel(String id, Channel channel) {
        channelMap.put(id, channel);
    }

    public static Channel getChannel(String id) {
        return channelMap.get(id);
    }

    public static void removeChannel(String id) {
        channelMap.remove(id);
    }

    public static ConcurrentHashMap<String, Channel> selectList() {
        return channelMap;
    }
}
